package com.kele.aop;

import com.kele.cal.Cal;
import com.kele.cal.impl.CalImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @Version 2019
 * @Author:kele
 * @Date:2021/6/6
 * @Content:
 * @Description：
 */
public class AopTest {
    public static void main(String[] args) {
//        //实例化委托对象
//        Cal cal=new CalImpl();
//        //获取代理对象
//        MyInvocationHandler myInvocationHandler=new MyInvocationHandler();
//        Cal proxy = (Cal) myInvocationHandler.bind(cal);
//        proxy.add(10,3);

        ApplicationContext applicationContext=new ClassPathXmlApplicationContext("spring-aop.xml");
        Cal calIml = (Cal) applicationContext.getBean("calImpl");
        System.out.println(calIml.add(10,4));
    }
}
